from pypinyin import lazy_pinyin
t = input('请输入文件名')
p = input('请输入省份').split()
f1 = open('yq_in.txt', 'r')
f2 = open('test1.txt', 'w')
line = f1.readlines()
a = ''
s = 0
b = []
dic = dict()

for i in p:
        for l in line:
            curline = l.strip().split("\t")
            if i != '':
                if a != curline[0]:
                    a = curline[0]
                    if a == i:
                        b.append(curline)
                if a == i:
                    for j in range(1, 3):
                        s = s + int(curline[2])
                        f2.write(curline[j])
                        f2.write('\t')
                    f2.write('\n')

        #     else:
        #         if a != curline[0]:
        #             a = curline[0]
        #             f2.write('\n')
        #             f2.write(curline[0])
        #             f2.write('\n')
        #         for i in range(1, 3):
        #             f2.write(curline[i])
        #             f2.write('\t')
        #         f2.write('\n')
        # dic[i] = s
        # f2.write(i)
        # f2.write('\t')
        # f2.write(str(s))
        # f2.write('\n')
f1.close()
f2.close()